home *** CD-ROM | disk | FTP | other *** search
- #ifndef NUDP
-
- #include "global.h"
- #include "netuser.h"
-
- /* User Datagram Protocol definitions */
-
- #define NUDP 20
-
- /* Structure of a UDP protocol header */
- struct udp {
- int16 source; /* Source port */
- int16 dest; /* Destination port */
- int16 length; /* Length of header and data */
- int16 checksum; /* Checksum over pseudo-header, header and data */
- };
- #define UDPHDR 8 /* Length of UDP header */
-
- /* User Datagram Protocol control block
- * Each entry on the receive queue consists of the
- * remote socket structure, followed by any data
- */
- struct udp_cb {
- struct udp_cb *prev; /* Linked list pointers */
- struct udp_cb *next;
- struct socket socket; /* Local port accepting datagrams */
- void (*r_upcall) __ARGS((struct udp_cb *,int));
- /* Function to call when one arrives */
- struct mbuf *rcvq; /* Queue of pending datagrams */
- int rcvcnt; /* Count of pending datagrams */
- int user; /* User link */
- };
- extern struct udp_cb *Udps[]; /* Hash table for UDP structures */
- #define NULLUDP (struct udp_cb *)0
-
- /* UDP statistics counters */
- struct udp_stat {
- int16 rcvd; /* Packets received */
- int16 sent; /* Packets sent */
- int16 cksum; /* Checksum errors */
- int16 unknown; /* Unknown socket */
- int16 bdcsts; /* Incoming broadcasts */
- };
- extern struct udp_stat Udp_stat;
-
- /* UDP primitives */
-
- /* In udp.c: */
- int del_udp __ARGS((struct udp_cb *up));
- struct mbuf *htonudp __ARGS((struct udp *udp,struct mbuf *data,struct pseudo_header *ph));
- int ntohudp __ARGS((struct udp *udp,struct mbuf **bpp));
- struct udp_cb *open_udp __ARGS((struct socket *lsocket,
- void (*r_upcall) __ARGS((struct udp_cb *,int))));
- int recv_udp __ARGS((struct udp_cb *up,struct socket *fsocket,struct mbuf **bp));
- int send_udp __ARGS((struct socket *lsocket,struct socket *fsocket,char tos,
- char ttl,struct mbuf *data,int16 length,int16 id,char df));
- void udp_input __ARGS((struct mbuf *bp,struct ip *ip,int rxbroadcast));
-
- /* In udpcmd.c: */
- void st_udp __ARGS((struct udp_cb *udp,int n));
-
- #endif /* NUDP */
-
-